﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Compilation;

namespace Vision.Utilities.ConsoleApp.PreCompilation
{
    public class CmsClientBuildManagerCallback : ClientBuildManagerCallback
    {
        public override void ReportCompilerError(System.CodeDom.Compiler.CompilerError error)
        {
            Console.WriteLine(string.Format("    [{0}]:", error.IsWarning ? "WARNING" : "ERROR"));
            Console.WriteLine(string.Format("    FileName:{0}; Line:{1}; Column:{2};", error.FileName, error.Line, error.Column));
            Console.WriteLine(string.Format("    ErrorNumber:{0}", error.ErrorNumber));
            Console.WriteLine(string.Format("    ErrorText:"));
            Console.WriteLine(string.Format("    {0}", error.ErrorText));
        }

        public override void ReportParseError(System.Web.ParserError error)
        {
            Console.WriteLine(string.Format("    [Parse ERROR]:"));
            Console.WriteLine(string.Format("    Path:{0}; Line:{1};", error.VirtualPath, error.Line));
            Console.WriteLine(string.Format("    ErrorText:"));
            Console.WriteLine(string.Format("    {0}", error.ErrorText));
        }

        public override void ReportProgress(string message)
        {
            Console.WriteLine(string.Format("{0}:{1}", DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff"), message));
        }
    }
}
